page.pageInit=function(){
	$("#iframe_content").height(document.documentElement.clientHeight - 96);
	//加载提示新闻
	setTimeout(function(){
		loadNotice();
	},2000);
}

page.form = {};
page.form.init = function(){
}

//对外通用新增tab
function addTable(id,name,url){
	$("#iframe_content").attr("src",url+"?menuId="+id);
}

//打开一个iframe
function addIfreameWinodw(id,url){
	$("#iframe_content").attr("src",url+"?id="+id);
}

//加载提示新闻
function loadNotice(){
	postNotice(contextPath + "/common/windowNotice.htm", {},function(result) {
		if (result.success) {
			showNotice(result.data.noticeName,contextPath+"/common/noticeDetailWindow.htm",{id:result.data.noticeId});
		}
	});
}

function postNotice (url,data,successfun,errorfun){
	 $.ajax({
         async: true,
         type: 'POST',
         url: url,
         data: data,
         dataType: "json",
         success: function(rs){
         	if(successfun)successfun(rs);
         },
         error:function(rs){
         	if(errorfun){
         		errorfun(rs);
         	}else{
         		if(successfun)successfun({success:false,msg:"系统错误,请联系管理员."});
         	}
         },complete: function(XMLHttpRequest, textStatus, xhr) {
 	        var oauthstatus = XMLHttpRequest.getResponseHeader("oauthstatus");
 	        if(oauthstatus == '401'){
 	        	 window.location.href = contextPath + "/view.htm";
 	            return;
 	        }
 	    }
     });
}

//弹出层
var showNotice = function(name,url,params){
	  var layerParams = {
			  type:0 
      		  ,title: name
      		  ,area: [(page.window.width*0.8)+'px', (page.window.height*0.8)+'px']
      		  //,shade: 0
      		  ,btn:null
      		  ,maxmin: false
      		  ,scrollbar:true
      		  ,zIndex: 800 //重点1
	  }
	 $.ajax({
	        url: url,
	        global: false,
	        type: "POST",
	        dataType: "html",
	        data:params,
	        async: false,
	        success: function(msg) {
	           layerParams.content = msg;
	           layer.open(layerParams);
	        }
	    })
	    //keydown
	    $("body").keydown(function(e){
	    	 if(e.keyCode == 13){
	    		 return false;
	    	 }
	    });
}

